
$(function () {
    // $("<div id='swtCenter' class='swtCenter'><div class='swtClose'><a href='javascript:;'></a></div><div class='callBack clearFix'> <input id='tell_num' name='tell_num' onFocus='this.value='';' placeholder='请输入您的电话号码 !' type='tel'> <input id='sub_btn' value='免费电话' type='button' onClick='calltelx()'> </div> <div class='swtList'> <p><a class='telphone' href='tel:"+isphone[2]+"'><i></i><em>拨打电话</em></a></p> <p><a class='question' href='javascript:void(0);' onClick='openZoosUrl();return false;'><em>立即咨询</em></a></p> </div> </div>").appendTo('body');
    // $("<ul class='footer' style='width: 100%;height: 1.22rem;padding-top: 0.24rem;box-sizing: border-box;position: fixed;bottom: 0;left: 0;margin: auto;background: url(../images/indexfooter.png)no-repeat; background-size: cover;'> <li class='f1'> <a href='/'>首页</a></li><li class='f2'><a href='/products/flcx'>分类查询</a></li><li class='f3 color'><a href='javascript:void(0);' onClick='openZoosUrl();return false;'></a></li><li class='f5'> <a href='/aboutus.php'>尚标优势</a></li><li class='f4'><a href='/mem/index'>个人中心</a></li></ul>").appendTo('body');
    $("body").css({
        "padding-bottom":"14%"
    })
    $("input").focus(function(){
        $('.footer').addClass('none');
    });
    $("input").blur(function(){
        $('.footer').removeClass('none');
    });
    $('.swtClose').on('touchend',function (e) {
        e.preventDefault();
        $('.swtCenter').addClass('none');
    });

//setTimeout(showa,5000);
    function showa() {
        $('.swtCenter').addClass('block');
    }


    /*banner轮播*/
    var gallery = mui('.mui-slider');
    gallery.slider({
        interval:3000//自动轮播周期，若为0则不自动播放，默认为0；
    });

    $('.banner .b_list li:nth-child(2)').on('touchend',function () {
       $('.banner .b_list .xian').css({
           transform: 'translate3d(220%,0,0)',
       })
        $('.b_list li').removeClass('color');
        $(this).addClass('color');
        $('.banner .b_inner').removeClass('block');
        $('.banner .b_inner.tow').addClass('block');
    })
    $('.banner .b_list li:nth-child(1)').on('touchend',function () {
        $('.banner .b_list .xian').css({
            transform: 'translate3d(0,0,0)',
        });
        $('.b_list li').removeClass('color');
        $(this).addClass('color');
        $('.banner .b_inner').removeClass('block');
        $('.banner .b_inner.one').addClass('block');
    })

    //2016年12-28 新增
    $('.sbsubmit').on('touchend',function () {
        var sbclass = $(".sbclass option:selected").val();
        var sbname =$('.sbname').val();
        if(sbclass =='' && sbname ==''){ 
			sb_tssc('请填写您想要搜索的商标信息！');
            $(".sbclass option:selected").focus();
            $('.sbname').focus();
            return false;
        }
        window.location.href='/list.php?bigclassid='+sbclass+'&search_keyword='+sbname;

    })
    $('.zlsubmit').on('touchend',function () {
        var zlclass = $(".zlclass option:selected").val();
        var zlname =$('.zlname').val();
        if(zlclass =='' && zlname ==''){
			sb_tssc('请填写您想要搜索的专利信息！');
            $(".zlclass option:selected").focus();
            $('.zlname').focus();
            return false;
        }
        window.location.href='/zl/list?type='+zlclass+'&search_key='+zlname;
    })

    //haslqyhq();
    //领取会员注册优惠券
    $("#lqyhq").on("touchend",function(){
     $.ajax({
            url : "/index/getregcoup",
            type :"GET",
            dataType : "json",
            success :function(data){
                if(data['code'] == 1)
                {
                    //没有登录
                    location.href="/mem/login?redirurl=index";
                }else if(data['status'] == 0)
                {
                    //领取成功
                    yhqclose();
                    alert('恭喜您，领取成功！');
                    setTimeout(showa,5000);
                }else if(data['status'] == 1)
                {
                    yhqclose();
                   alert('很抱歉，您已经领取过！');
                    setTimeout(showa,5000);
                }
            },
        });
    });
    var isClicka = true;
    $('.yhq .guanbi').on('touchstart', function(e){
        isClicka = true;
    });
    $('.yhq .guanbi').on('touchmove', function(e){
        isClicka = false;
    });
    $('.yhq .guanbi').on('touchend', function(e){
        if (isClicka == true){
            yhqclose();
            setTimeout(showa,5000);
        }
    })

    var isClickb = true;
    $('.zhezhao').on('touchstart', function(e){
        isClickb = true;
    });
    $('.zhezhao').on('touchmove', function(e){
        isClickb = false;
    });
    $('.zhezhao').on('touchend', function(e){
        if (isClickb == true){
            yhqclose();
            setTimeout(showa,5000);
        }
    })

    $.ajax({
        url : "index/haveyhq",
        dataType: 'json',
        type : "GET",
        success : function (data) {
            if(data["code"] == "1")
            {
                //已经领取了
                setTimeout(showa,5000);
            }else{
                //没有领取或者说未登录状态
                $(".yhq,.zhezhao").show();
            }
        }
    });


})

function yhqclose()
{
    $('.yhq').fadeOut();
    $('.zhezhao').fadeOut();
}
//判断会有是否已经领取了优惠券
function haslqyhq()
{
    $.ajax({
        url : 'index/haveyhq',
        type: "GET",
        dataType : 'json',
        success :function(data)
        {
            if (data['code'] == 1 )
            {
                //领取过了
                $(".yhq").hide();
                $(".zhezhao").hide();
            }
        }
    });
}
function calltelx()
{
    lxb.call(document.getElementById("tell_num").value);
    $("#tell_num").val();
    return false;
}
